package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GwNoticeStaffMapper;
import com.ruoyi.system.domain.GwNoticeStaff;
import com.ruoyi.system.service.IGwNoticeStaffService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 通知公告员工Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-29
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class GwNoticeStaffServiceImpl implements IGwNoticeStaffService {

    @Resource
    private GwNoticeStaffMapper gwNoticeStaffMapper;

    /**
     * 查询通知公告员工
     *
     * @param id 通知公告员工主键
     * @return 通知公告员工
     */
    @Override
    public GwNoticeStaff selectGwNoticeStaffById(String id) {
        return gwNoticeStaffMapper.selectGwNoticeStaffById(id);
    }

    /**
     * 查询通知公告员工列表
     *
     * @param gwNoticeStaff 通知公告员工
     * @return 通知公告员工
     */
    @Override
    public List<GwNoticeStaff> selectGwNoticeStaffList(GwNoticeStaff gwNoticeStaff) {
        return gwNoticeStaffMapper.selectGwNoticeStaffList(gwNoticeStaff);
    }

    /**
     * 新增通知公告员工
     *
     * @param gwNoticeStaff 通知公告员工
     * @return 结果
     */
    @Override
    public int insertGwNoticeStaff(GwNoticeStaff gwNoticeStaff) {
        gwNoticeStaff.setCreateTime(DateUtils.getNowDate());
        gwNoticeStaff.setCreateBy(SecurityUtils.getUsername());
        gwNoticeStaff.setUpdateTime(DateUtils.getNowDate());
        gwNoticeStaff.setUpdateBy(SecurityUtils.getUsername());
        return gwNoticeStaffMapper.insertGwNoticeStaff(gwNoticeStaff);
    }

    /**
     * 修改通知公告员工
     *
     * @param gwNoticeStaff 通知公告员工
     * @return 结果
     */
    @Override
    public int updateGwNoticeStaff(GwNoticeStaff gwNoticeStaff) {
        gwNoticeStaff.setUpdateTime(DateUtils.getNowDate());
        gwNoticeStaff.setUpdateBy(SecurityUtils.getUsername());
        return gwNoticeStaffMapper.updateGwNoticeStaff(gwNoticeStaff);
    }

    /**
     * 批量删除通知公告员工
     *
     * @param ids 需要删除的通知公告员工主键
     * @return 结果
     */
    @Override
    public int deleteGwNoticeStaffByIds(String[] ids) {
        return gwNoticeStaffMapper.deleteGwNoticeStaffByIds(ids);
    }

    /**
     * 删除通知公告员工信息
     *
     * @param id 通知公告员工主键
     * @return 结果
     */
    @Override
    public int deleteGwNoticeStaffById(String id) {
        return gwNoticeStaffMapper.deleteGwNoticeStaffById(id);
    }
}
